<?php
require_once("taskView.php");
require_once(CORE_DIR.'taskModel.php');

class getnotificationsAction extends authAction{

	function __construct(){
		$this->view = new taskView();
	}

	public function run($get, $post, $viewtype) {
		parent::run($get,$post,$viewtype);
		
		$tModel = new taskModel();		
		if (isset($get["userid"]) && isset($get["datefrom"]))
		{
			$userId = $get["userid"];
			$dateFrom = date("Y-m-d H:i:s", strtotime($get["datefrom"]));
			
			$notifications = $tModel->getNotificationList($dateFrom, $userId);
			
			$this->view->setProperty("notifications", $notifications);
			$this->view->showGetUserNotifications();
		}
		else 
		{
			$this->view->showBadCmd();
		}
	}
}
?>